import React, { createContext, useState, useContext } from 'react'

const context = createContext()

// console.log(context)

function Home3() {
    const [count, setCount] = useState(8888)
    return (
        <div>
            Home3 ---- { count }
            <context.Provider value = { count }>
                <Home4/>
            </context.Provider>
        </div>
    )
}

function Home4() {
    return (
        <div>
             Home4 ---- 
             <Home5/>
        </div>
    )
}

function Home5() {
    const val = useContext(context)
    return (
        <div>
            Home5 ---- { val }
            {/* <context.Consumer>
                {
                    (data) => {
                        return data
                    }
                }
            </context.Consumer> */}
        </div>
    )
}

export default Home3
